namespace FIREFLYX {
    /** webgl 能力 */
    export class WebglCapability {
        private static _webgl2: WebGL2RenderingContext;
        /** 当前设备支持的最大纹理数 */
        public static MAX_COMBINED_TEXTURE_IMAGE_UNITS: number;
        /** 当前设备支持的单个UBO 最大byte数值 */
        public static MAX_UNIFORM_BLOCK_SIZE: number;
        /** */
        public static UNIFORM_BUFFER_OFFSET_ALIGNMENT: number;
        /** 当前设备支持的最大uniform block数量*/
        public static MAX_COMBINED_UNIFORM_BLOCKS: number;
        /** 当前设备支持的顶点着色器中最大 uniform block数量*/
        public static MAX_VERTEX_UNIFORM_BLOCKS: number;
        /** 当前设备支持的片元着色器最大uniform block数量*/
        public static MAX_FRAGMENT_UNIFORM_BLOCKS: number;

        //-----------------ext------------------
        /** 各项异性滤波拓展 */
        public static EXT_texture_filter_anisotropic: Nullable<EXT_texture_filter_anisotropic>;

        //--------------------------------------

        /** 初始化 */
        public static init(gl: WebGL2RenderingContext) {
            //
            this._webgl2 = gl;
            // eslint-disable-next-line no-empty
            if (this._webgl2) { }

            //设备相关能力限值
            this.MAX_COMBINED_TEXTURE_IMAGE_UNITS = gl.getParameter(gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS);
            this.MAX_UNIFORM_BLOCK_SIZE = gl.getParameter(gl.MAX_UNIFORM_BLOCK_SIZE);  //单个UBO 最大byte
            this.UNIFORM_BUFFER_OFFSET_ALIGNMENT = gl.getParameter(gl.UNIFORM_BUFFER_OFFSET_ALIGNMENT);  //
            this.MAX_VERTEX_UNIFORM_BLOCKS = gl.getParameter(gl.MAX_VERTEX_UNIFORM_BLOCKS);
            this.MAX_FRAGMENT_UNIFORM_BLOCKS = gl.getParameter(gl.MAX_FRAGMENT_UNIFORM_BLOCKS);
            this.MAX_COMBINED_UNIFORM_BLOCKS = gl.getParameter(gl.MAX_COMBINED_UNIFORM_BLOCKS);

            //拓展相关
            this.EXT_texture_filter_anisotropic = gl.getExtension("EXT_texture_filter_anisotropic") ||
                gl.getExtension("MOZ_EXT_texture_filter_anisotropic") ||
                gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic");

        }
    }
}